import request from '@/utils/request'
// 注册
export const register = (data) => {
  return request.post('/user/registered', data)
}

// 登录
export const login = (data) => {
  return request.post('/user/login', data)
}

// 用户信息
export const userMsg = () => {
  return request.get('/user')
}

// 退出
export const logout = () => {
  return request.post('/user/logout')
}

// 轮播图
export const home = () => {
  return request.get('/home/swiper')
}

// 收藏列表
export const collectionList = () => {
  return request.get('/user/favorites')
}
// 查看已发布房源列表
export const getMyRental = () => {
  return request.get('/user/houses')
}
// 房屋是否收藏
export const isCollect = (id) => {
  return request.get(`/user/favorites/${id}`)
}
// 添加收藏
export const AddCollect = (id) => {
  return request.post(`/user/favorites/${id}`)
}
// 删除收藏
export const DelCollect = (id) => {
  return request.delete(`/user/favorites/${id}`)
}

// 已发布房源列表
export const HousesList = () => {
  return request.get('/user/houses')
}
// 获取房源列表
export const HousesLists = () => {
  return request.get('/admin/houses')
}
// 发布房源
export const updateHouse = (data) => {
  return request.post('/user/houses', data)
}
